'use strict'
let data={}
class friendlist{

  constructor (mdb) {
    this.mdb = mdb || null
  }
  async post(c){
    data.uid=JSON.parse(c)
  }
  async get () {
    try{
      let sql=`select * from user_friends,users where user_friends.uid=users.uid and user.uid=${data.uid}`
      let r=await this.mdb.query(sql)
      let result=r['rows']
      if(result.rowCount<=0){
        return ('failed register',400)
      }
      return result

    }catch(e){
      return ('failed',400)
    }
  }
 
}

module.exports = friendlist
